createin=function(s1,s2) { 
 toReplacein(document.getElementById(s1),s2)
    } 

toReplacein = function(divElement,url) { 
    var inputElement = document.createElement("input"); 
    inputElement.value = divElement.innerHTML; 
    divElement.parentNode.replaceChild(inputElement, divElement); 
	inputElement.focus();
    inputElement.onblur = function() { 
    	$.getJSON("question_"+url+"&&update="+inputElement.value, function(result){
    		divElement.innerHTML = result; 
    	});
        
        inputElement.parentNode.replaceChild(divElement, inputElement); 
    } 
} 

createse=function(s1,s2) { 
	 toReplacese(document.getElementById(s1),s2)
	    } 

	toReplacese = function(divElement,url) { 
	    var select = document.createElement("select");
	    $.getJSON("type_listJson", function(result){
    		for(i in result){
    		var option = document.createElement("option");	
    		option.setAttribute("value",result[i].id);
    		if(result[i].name==divElement.innerHTML){
    		option.setAttribute("selected","selected");
    		}
    		option.innerHTML=result[i].name;
    		select.appendChild(option);
    		}
    	});
         divElement.parentNode.replaceChild(select, divElement); 
         select.focus();
         select.onblur = function() { 
	    	$.getJSON("question_"+url+"&&update="+select.value, function(result){
	    		divElement.innerHTML = result; 
	    	});    
        	 select.parentNode.replaceChild(divElement, select); 
	    } 
	} 